package com.xuecheng.content.convert;
import com.xuecheng.api.content.model.CourseBaseDTO;
import com.xuecheng.api.content.model.vo.CourseAuditVO;
import com.xuecheng.api.content.model.vo.CourseBaseVO;
import com.xuecheng.content.entity.CourseBase;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
 * <p>
 *     对象属性转换器：
 *      PS：将MapStruct依赖添加到工程中
 *      1.创建一个接口并在类上添加 @Mapper 注解
 *      2.在接口通过MapStruct的api创建出接口的实例对象
 *      3.转换方法
 *          传入参数、传出参数
 *          将传入参数里的数据会赋值给传出参数
 *
 *      特点：
 *          1.对象中的属性转换数据时，默认情况下将两个对象中的同属性名进行赋值操作
 *
 * </p>
 *
 * @Description:
 */
@Mapper
public interface CourseBaseConvert {
    //构建属性转换示例
    CourseBaseConvert INSTANCE = Mappers.getMapper(CourseBaseConvert.class);
    //将 CourseBase 转为  CourseBaseDTO
    @Mapping(target = "courseBaseId",source = "id")
    CourseBaseDTO entity2dTo(CourseBase courseBase);

    //将 CourseBaseDTO  转为  CourseBase
    @Mappings({@Mapping(target = "id",source = "courseBaseId") })
    CourseBase dto2entity(CourseBaseDTO student);

    CourseBaseDTO vo2dto(CourseBaseVO vo);
    CourseBaseDTO voAuto2dto(CourseAuditVO vo);
    CourseBase dto2po(CourseBaseDTO dto);
//    @Mappings({@Mapping(target = "courseBaseId",source = "id") })
//    CourseBaseDTO po2dto(CourseBase courseBase);
    List<CourseBaseDTO> entitys2dtos(List<CourseBase> courseBase);
   // @Mappings({@Mapping(target = "courseBaseId",source = "id") })
}